package org.perla.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 */
@Entity
@Table(name = "nodo")
@NamedQueries({
    @NamedQuery(name = "Nodo.findAll", query = "SELECT n FROM Nodo n"),
    @NamedQuery(name = "Nodo.findByIdNodo", query = "SELECT n FROM Nodo n WHERE n.idNodo = :idNodo"),
    @NamedQuery(name = "Nodo.findByAlias", query = "SELECT n FROM Nodo n WHERE n.alias = :alias"),
    @NamedQuery(name = "Nodo.findByCoordn", query = "SELECT n FROM Nodo n WHERE n.coordn = :coordn"),
    @NamedQuery(name = "Nodo.findByCoorde", query = "SELECT n FROM Nodo n WHERE n.coorde = :coorde"),
    @NamedQuery(name = "Nodo.findByIdMaster", query = "SELECT n FROM Nodo n WHERE n.idMaster = :idMaster"),
    @NamedQuery(name = "Nodo.findByIsMaster", query = "SELECT n FROM Nodo n WHERE n.isMaster = :isMaster")})
public class Nodo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_NODO")
    private String idNodo;
    @Basic(optional = false)
    @Column(name = "ALIAS")
    private String alias;
    @Basic(optional = false)
    @Column(name = "COORDN")
    private String coordn;
    @Basic(optional = false)
    @Column(name = "COORDE")
    private String coorde;
    @Basic(optional = false)
    @Column(name = "ID_MASTER")
    private String idMaster;
    @Basic(optional = false)
    @Column(name = "IS_MASTER")
    private boolean isMaster;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nodo")
    private List<Sensori> sensoriList;

    public Nodo() {
    }

    public Nodo(String idNodo) {
        this.idNodo = idNodo;
    }

    public Nodo(String idNodo, String alias, String coordn, String coorde, String idMaster, boolean isMaster) {
        this.idNodo = idNodo;
        this.alias = alias;
        this.coordn = coordn;
        this.coorde = coorde;
        this.idMaster = idMaster;
        this.isMaster = isMaster;
    }

    public String getIdNodo() {
        return idNodo;
    }

    public void setIdNodo(String idNodo) {
        this.idNodo = idNodo;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    public String getCoordn() {
        return coordn;
    }

    public void setCoordn(String coordn) {
        this.coordn = coordn;
    }

    public String getCoorde() {
        return coorde;
    }

    public void setCoorde(String coorde) {
        this.coorde = coorde;
    }

    public String getIdMaster() {
        return idMaster;
    }

    public void setIdMaster(String idMaster) {
        this.idMaster = idMaster;
    }

    public boolean getIsMaster() {
        return isMaster;
    }

    public void setIsMaster(boolean isMaster) {
        this.isMaster = isMaster;
    }

    public List<Sensori> getSensoriList() {
        return sensoriList;
    }

    public void setSensoriList(List<Sensori> sensoriList) {
        this.sensoriList = sensoriList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idNodo != null ? idNodo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Nodo)) {
            return false;
        }
        Nodo other = (Nodo) object;
        if ((this.idNodo == null && other.idNodo != null) || (this.idNodo != null && !this.idNodo.equals(other.idNodo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.perla.entities.Nodo[idNodo=" + idNodo + "]";
    }

}
